<h2>Extend Loan</h2>

<div class="errorval"><?php echo validation_errors(); ?>
<?php echo $error; ?></div>
<!-- Loan information -->
<p>Enter valid information into the following fields:</p>
<center>
<table>
<?php echo form_open('staff/loan_management/extendLoan/' . $volume->access_id ); ?>
<tr>
	<th align="right" width=30%>Item:</th>
	<td><?php echo $volume->title . ' (' . $volume->access_id . ')'; ?></td>
</tr>
<tr>
	<th align="right">Loaned By:</th>
	<td><?php echo anchor('staff/subscriber_management/viewSubscriber/' . $subscriber->subscriber_id, $subscriber->first_name . ' ' . $subscriber->last_name); ?></td>
</tr>
<tr>
	<th align="right">Reserved By:</th>
	<td><?php if ($loan->reserve_subscriber) echo anchor('staff/subscriber_management/viewSubscriber/' . $loan->reserve_subscriber, $loan->reserve_subscriber) . ' <font color="red">(RESERVED. DO NOT EXTEND LOAN)</font>'; ?></td>
</tr>
<tr>
	<th align="right">Loan Date:</th>
	<td><?php echo $loan->loan_date; ?></td>
</tr>
<tr>
	<th align="right">Extension Date:</th>
	<td><?php echo form_input('extension_date', date('Y-m-d')); ?></td>
</tr>
<tr>
	<th align="right">Original Due Date:</th>
	<td><?php echo $loan->due_date; ?></td>
</tr>
<tr>
	<th align="right">New Due Date:</th>
	<td><?php echo form_input('due_date', date('Y-m-d', mktime(0, 0, 0, date('m') + 1, date('d'), date('Y')))); ?></td>
</tr>
<tr>
	<th align="right" class="tablehead">Actions</th>
	<td><?php echo form_submit('extendLoan', 'Submit'); ?></td>
</tr>
<?php echo form_close(); ?>
</table>

</center>

<script type="text/javascript">
$(document).ready(function() {
		$( "[name=extension_date]" ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true });
		$( "[name=due_date]" ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true });
});
</script>
